Skip to content

Conversation

@arshidkv12
Copy link
Contributor

This replaces zend_parse_parameters() with the ZEND_PARSE_PARAMETERS_START/END macros, which provide
exception-aware parameter parsing and align the code with modern php-src conventions.

Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is done, it should be consistently done for exif_imagetype() as well.

@arshidkv12 arshidkv12 requested a review from TimWolla February 4, 2026 09:52
@Girgias
Copy link
Member

Girgias commented Feb 4, 2026

This replaces zend_parse_parameters() with the ZEND_PARSE_PARAMETERS_START/END macros, which provide exception-aware parameter parsing and align the code with modern php-src conventions.

zend_parse_parameters() is also exception aware. And it is not really a modern convention, Fast ZPP got introduced to reduce the overhead of calling ZPP for hot/short functions. Fast ZPP introduces some code bloat into every function, although @ndossche knows more the details about this.

So I'm not sure whether that's really a good motivation here.

@arshidkv12
Copy link
Contributor Author

arshidkv12 commented Feb 4, 2026

I think fast ZPP is indirectly more secure, because null-safety is part of it.

@Girgias
Copy link
Member

Girgias commented Feb 5, 2026

I think fast ZPP is indirectly more secure, because null-safety is part of it.

I don't understand what you mean?

@arshidkv12
Copy link
Contributor Author

PHP_FUNCTION(my_function)
{
    zend_string *my_str;

    ZEND_PARSE_PARAMETERS_START(1, 1)
        Z_PARAM_STR(my_str)
    ZEND_PARSE_PARAMETERS_END();

    php_printf("String value: '%s'\n", ZSTR_VAL(my_str)); //This value is never NULL
}

@arshidkv12
Copy link
Contributor Author

Sorry, I’m confused.

@Girgias
Copy link
Member

Girgias commented Feb 5, 2026

PHP_FUNCTION(my_function)
{
    zend_string *my_str;

    ZEND_PARSE_PARAMETERS_START(1, 1)
        Z_PARAM_STR(my_str)
    ZEND_PARSE_PARAMETERS_END();

    php_printf("String value: '%s'\n", ZSTR_VAL(my_str)); //This value is never NULL
}

I don't see why this is an issue with "old" ZPP? Especially fast ZPP can still have this issue if the parameter is optional.

@arshidkv12
Copy link
Contributor Author

Thank you

@arshidkv12 arshidkv12 closed this Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants